home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 June: Reference Library / Dev.CD Jun 99 RL Disk 1.toast / Technical Documentation / Develop / Additional Articles / Developing Symbiotic Apps / Symbiotic Samples / Symbiotic client source / Trident.cw10_pp / CTridentIdler.cp < prev    next >
Encoding:
Text File  |  1996-08-19  |  1.6 KB  |  59 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CTridentIdler.cp                        ©1993 Metrowerks Inc. All rights reserved.
  3. // ===========================================================================
  4. // see powerplant mail for this example
  5.  
  6. #include "CTridentIdler.h"
  7. #include "CTridentView.h"
  8. #include <Events.h>
  9.  
  10. // ---------------------------------------------------------------------------
  11. //        • HeartBeatMonitor
  12. // ---------------------------------------------------------------------------
  13. //    Initialises the key chain monitor.
  14.  
  15.  
  16. CHeartBeatIdler::CHeartBeatIdler()  :LPeriodical()
  17. {
  18. fLastHeartBeat = 0;
  19. fOwnerView = NULL;
  20. }
  21.  
  22.  
  23. // ---------------------------------------------------------------------------
  24. //        • SpendTime
  25. // ---------------------------------------------------------------------------
  26. //    This method is executed at idle time
  27.  
  28. void
  29. CHeartBeatIdler::SpendTime(const EventRecord &/* inMacEvent */)
  30. {
  31.  
  32. if  ((fLastHeartBeat +  7200) < TickCount())        //two minutes  (7200 ticks) have passed
  33.     {
  34.     this->fOwnerView->SendHeartBeat();
  35.     SysBeep(1);
  36.     }
  37. }
  38.  
  39. // ---------------------------------------------------------------------------
  40. //        • ResetTicks
  41. // ---------------------------------------------------------------------------
  42.  
  43. void
  44. CHeartBeatIdler::ResetTicks()
  45. {
  46.  
  47. fLastHeartBeat  = TickCount();  
  48. }
  49.  
  50. // ---------------------------------------------------------------------------
  51. //        • SetOwner
  52. // ---------------------------------------------------------------------------
  53.  
  54. void
  55. CHeartBeatIdler::SetOwnerView(CTridentView* theOwner)
  56. {
  57.     this->fOwnerView  = theOwner;  
  58. }
  59.